package cn.net.cfss.fgbp.spi.manage.constant;

import cn.net.cfss.fgbp.base.constant.BaseEnum;
import cn.net.cfss.fgbp.base.vo.SysEnumVo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author wutao
 * @version 1.0
 * @date 2021/3/4 17:04
 */
public enum HolidayTypeEnum implements BaseEnum<HolidayTypeEnum , Integer> {


    HOLIDAY(1, "法定放假日"),
    WORK(2, "法定上班日");

    private Integer value;
    private String displayName;

    HolidayTypeEnum(Integer value , String displayName){
        this.value = value;
        this.displayName = displayName;
    }


    @Override
    public Integer getValue() {
        return this.value;
    }

    @Override
    public String getDisplayName() {
        return this.displayName;
    }


    public static HolidayTypeEnum getEnum(Integer value) {
        return enumMap.get(value);
    }

    private static Map<Integer, HolidayTypeEnum> enumMap = new HashMap<Integer, HolidayTypeEnum>();

    static {
        for (HolidayTypeEnum en : HolidayTypeEnum.values()) {
            enumMap.put(en.getValue(), en);
        }
    }

    public static List<SysEnumVo> getEnum() {
        List<SysEnumVo> list = new ArrayList();
        for (HolidayTypeEnum en : HolidayTypeEnum.values()) {
            SysEnumVo vo = new SysEnumVo();
            vo.setVal(en.getValue());
            vo.setDisplayName(en.getDisplayName());
            vo.setName(en.name());
            list.add(vo);
        }
        return list;
    }
}
